//
//  AppNetwork+Home.m
//  XiaoMiao
//
//  Created by 23 on 2017/12/1.
//  Copyright © 2017年 smallyou. All rights reserved.
//

#import "AppNetwork+Home.h"


@implementation AppNetwork (Home)

/**获取首页轮播图*/
+ (AppURLSessionTask *)getHomeBannerCompletion:(void(^)(BOOL success,NSArray * list, NSString *errorMsg))completion{
    
    
    AppURLSessionTask *task = [AppNetwork getWithUrl:kV2GetHomeBannerPath refreshCache:NO params:nil success:^(id response) {
        

        
        NSArray * list = [NSArray modelArrayWithClass:[XMHomeBannerModel class] json:response[@"bannerViews"]];
        
        if (completion) {
            completion(YES,list, nil);
        }
        
    } fail:^(AppError *error) {
        
        if (completion) {
            completion(NO,nil,[error errorMessage]);
        }
        
    }];
    
    return task;
    
}

/**检验注册验证码*/
+ (AppURLSessionTask *)checkRegisterCodeWithPhone:(NSString *)phone smsCode:(NSString *)smsCode Completion:(void(^)(BOOL success,id responseStr, NSString *errorMsg))completion{
    
    
    NSMutableDictionary *param = [NSMutableDictionary dictionary];
    [param setValue:phone forKey:@"phone"];
    [param setValue:smsCode forKey:@"smsCode"];

    AppURLSessionTask *task = [AppNetwork getWithUrl:kV2CheckRegisterCodePath refreshCache:NO params:param success:^(id response) {
        
        
        if (completion) {
            completion(YES,response, nil);
        }
        
    } fail:^(AppError *error) {
        
        if (completion) {
            completion(NO,nil,[error errorMessage]);
        }
        
    }];
    
    return task;
    
}
@end
















